import request from '@/utils/request'

// 查询自动代发规则列表
export function listAutopay(query) {
  return request({
    url: '/autopay/rule/v1.0/list',
    method: 'get',
    params: query
  })
}

// 查询角色详细
export function getRule(strategyId) {
  return request({
    url: '/autopay/rule/v1.0/detail/' + strategyId,
    method: 'get'
  })
}

// 新增自动代发规则
export function addRule(data) {
  return request({
    url: '/autopay/rule/v1.0/add',
    method: 'post',
    data: data
  })
}

// 修改自动代发规则
export function updateRule(data) {
  return request({
    url: '/autopay/rule/v1.0/update',
    method: 'post',
    data: data
  })
}

// 角色数据权限
export function dataScope(data) {
  return request({
    url: '/system/role/dataScope',
    method: 'put',
    data: data
  })
}

// 角色状态修改
export function changeRoleStatus(roleIds, status) {
  const data = {
    roleIds,
    status
  }
  return request({
    url: '/account/role/updateStatus',
    method: 'post',
    data: data
  })
}

// 删除角色
export function delRule(strategyId) {
  const data = {
    strategyId
  }
  return request({
    url: '/autopay/rule/v1.0/del',
    method: 'post',
    data: data
  })
}

// 导出角色
export function exportRole(query) {
  return request({
    url: '/system/role/export',
    method: 'get',
    params: query
  })
}